<?php
$valid_file_name = strrev($_SERVER['SCRIPT_NAME']);

if (substr($valid_file_name,0,strpos($valid_file_name, "/")) == strrev("clientssummary.php"))
{	
	$query = "SELECT CONCAT(lastname, ' ', firstname) AS fullname FROM mod_salertracking JOIN tbladmins ON tbladmins.id = mod_salertracking.userid WHERE mod_salertracking.clientid =".intval($_GET['userid'])." GROUP BY mod_salertracking.userid;";
	$rs = mysql_query($query);	
	if (mysql_num_rows($rs))
		$row = mysql_fetch_array($rs);
	else
		$row['fullname'] = "Nobody";
?>
<script language="javascript" type="text/javascript">
	$().ready(function(){
		$("table.form:first").append("<tr><td class='fieldlabel'>Saleperson</td><td class='fieldarea'><?php echo $row['fullname']; ?></td></tr>");		
	});
</script>
<?php
}
?>